<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>好运网</title>
    <link rel="stylesheet" type="text/css" href="/css/basic.css"/>
    <link rel="stylesheet" type="text/css" href="/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="/css/center.css"/>
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css"/>
    <link href="/css/public.css" rel="stylesheet"/>
    <script src="/js/jquery-1.4.2.min.js"></script>
</head>
<body>

<div th:fragment="questionWrite">

    <link rel="stylesheet" type="text/css" href="css/basic.css"/>
    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <link rel="stylesheet" type="text/css" href="css/center.css"/>

    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
    <link href="css/public.css" rel="stylesheet"/>
    <script src="js/jquery-1.4.2.min.js"></script>
    <script src="js/common.js"></script>


    <div class="as_fl20_right">
        <div class="as_bet_email">
            <div class="as_email_title">
                <h3>站内信</h3>
            </div>
            <div class="email_title_box">
                <div class="email_nav_title">
                    <ul>
                        <div class="email_nav_title">
                            <ul>
                                <a href="systemMessageReceive">
                                    <li><span data-id="take_email">收件箱 </span></li>
                                </a>
                                <a href="/questionDialog">
                                    <li class="middle"><span data-id="send_email">发件箱 </span></li>
                                </a>
                                <a href="/questionWrite">
                                    <li><span class="on" data-id="write_email">写消息</span></li>
                                </a>


                            </ul>
                        </div>
                    </ul>
                </div>

                <div id="take_email" class="take_email email_nr" style="display:block; border:none;">
                    <div id="write_email" class="email_nr write_email" style="display:block">
                        <div>
                            <form id="writeQuestionForm">
                                <table>
                                    <tbody>
                                    <tr>
                                        <td style="text-align:left; background-color:#fff;">标题：</td>
                                    </tr>
                                    <tr>
                                        <td><input placeholder="标题" name="questionTitle" id="messagetitle_text"
                                                   class="text r_inptut" style="width:100%"></td>
                                    </tr>
                                    <tr>
                                        <td style="text-align:left; background-color:#fff;">内容：</td>
                                    </tr>
                                    <tr>
                                        <td><textarea id="messagecontent_text" name="newQuestion"
                                                      placeholder="内容不得少于20字"></textarea></td>
                                    </tr>
                                    <tr>
                                        <td style=" background-color:#fff;">
                                            <button type="button" id="message_submit" class="as_but inputwd300"
                                                    style=" width:250px;margin-top:40px; margin-left:10px; margin-bottom:20px;">
                                                提交
                                            </button>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <link rel="stylesheet" href="/js/loading/loading.css">
    <script src="/js/loading/loading.js"></script>
    <script>
        var jiuXiuLoad = new Loading();
        jiuXiuLoad.init();

        $("#message_submit").click(function () {

            jiuXiuLoad.start();
            $.ajax({
                method: "POST",
                url: "/addNewQuestion",
                data: $("#writeQuestionForm").serializeArray(),
                dataType: "json"
            }).done(function (msg) {
                jiuXiuLoad.stop();
                if (msg.status == 'success') {
                    alert('保存成功!');
                    window.location.href = '/questionDialog';
                } else {
                    alert(msg.data)
                }
            });

        });

    </script>

</body>
</html>
